from manimlib import *

LV,QL,QH,JH='#75cfb8','#bbdfc8','#f0e5d8','#ffc478'

class p1(Scene):
    def construct(self):
        # self.add(NumberPlane())
        s1=Square(3).stretch(2,1)
        s2=s1.copy().rotate(53*DEGREES)
        # animate
        x=0.75
        p=Polygon([-1.5,3,0],[1.5,x,0],[1.5,-3,0],[-1.5,-x,0]).set_fill(LV,1)
        self.add(p,s1,s2)
        b2=Brace(s2,LEFT)
        b1=Brace(s1,DOWN)
        self.add(b1,b2,
            Tex('2').next_to(b2,LEFT),
            Tex('1').next_to(b1,DOWN),
            Tex('S=?')
        )
        self.wait()
class p2(Scene):
    def construct(self):
        # self.add(NumberPlane())
        s1=Square(3).stretch(2,1)
        s2=s1.copy().rotate(53*DEGREES)
        # animate
        x=0.75
        p4=Polygon([-1.5,3,0],[1.5,x,0],[1.5,-3,0],[-1.5,-x,0]).set_fill(LV,1)
        p3=Polygon([-1.5,-3,0],[1.5,-3,0],[-1.5,-x,0]).set_fill(JH,1)
        self.add(p4,p3,s1,s2)
        b2=Brace(s2,LEFT)
        b1=Brace(s1,DOWN)
        self.add(b1,b2,
            Tex('2').next_to(b2,LEFT),
            Tex('1').next_to(b1,DOWN),
            Tex('S=?'),
            Tex('x').next_to(p3,LEFT)
        )
        self.wait()